package com.quizzer.system.convert;

import com.quizzer.common.utils.bean.BeanUtils;
import com.quizzer.system.domain.Question;
import com.quizzer.system.dto.question.question.QuestionAddDto;
import com.quizzer.system.dto.question.question.QuestionOutputDto;
import com.quizzer.system.dto.question.question.QuestionQueryDto;
import com.quizzer.system.dto.question.question.QuestionUpdateDto;

/**
 * @author rong
 * @Description
 * @date 2025/10/7 21:39
 */
public class QuestionConverter {
    public static QuestionOutputDto toOutputDto(Question entity) {
        if(entity == null) {
            return null;
        }
        QuestionOutputDto dto = new QuestionOutputDto();
        BeanUtils.copyBeanProp(dto,entity);
        return dto;
    }
    public static Question toEntity(QuestionAddDto dto) {
        if(dto == null) {
            return null;
        }
        Question entity = new Question();
        BeanUtils.copyBeanProp(entity,dto);
        return entity;
    }
    public static Question toEntity(QuestionUpdateDto dto) {
        if(dto == null) {
            return null;
        }
        Question entity = new Question();
        BeanUtils.copyBeanProp(entity,dto);
        return entity;
    }
    public static Question toEntity(QuestionQueryDto dto) {
        if(dto == null) {
            return null;
        }
        Question entity = new Question();
        BeanUtils.copyBeanProp(entity,dto);
        return entity;
    }
}
